<%-- 
    Document   : checkBox
    Created on : 6/08/2013, 11:51:29 PM
    Author     : Alejandro Cazares
--%>
<%@attribute name="id" required="true"%>
<%@attribute name="valor" required="false"%>

<input type="hidden" name="${id}" id="${id}" value="${valor eq 'true' or valor eq 'false' ? valor : 'false'}" />
<span id="checkbox_${id}" class="clickeable">
    <i class="icomoon-checkbox${valor eq 'true' ? '':'2'}" id="icon_${id}"></i>
    &nbsp;<jsp:doBody />
</span>
<script>
    $(function(){
        $("#checkbox_${id}").click(function(){
            if($("#${id}").val() == 'false'){
                $("#${id}").val('true');
                $("#icon_${id}").addClass("icomoon-checkbox");
                $("#icon_${id}").removeClass("icomoon-checkbox2");
            }else{
                $("#${id}").val('false');
                $("#icon_${id}").addClass("icomoon-checkbox2");
                $("#icon_${id}").removeClass("icomoon-checkbox");                
            }
        });
    });
</script>